package com.lsa.letcode.the78.subsets;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.Test;

public class SubsetsTest {
	@Test
	public void test() throws Exception {
		Solution s = new Solution();
		 System.out.println(s.subsets(new int[] { 1, 2, 3 }));
		// System.out.println(s.subsets(new int[] { }));
		// System.out.println(s.subsets(new int[] { 11, 22, 33 }));

		test(s, Arrays.asList(new ArrayList<Integer>(), Arrays.asList(3),
				Arrays.asList(2), Arrays.asList(2, 3), Arrays.asList(1),
				Arrays.asList(1, 3), Arrays.asList(1, 2),
				Arrays.asList(1, 2, 3)), new int[] { 1, 2, 3 });

		test(s,
				Arrays.asList(new ArrayList<Integer>(),Arrays.asList(33), Arrays.asList(22),
						Arrays.asList(22, 33), Arrays.asList(11),
						Arrays.asList(11, 33), Arrays.asList(11, 22),
						Arrays.asList(11, 22, 33)), new int[] { 11, 22, 33 });

		test(s, Arrays.asList((List<Integer>) new ArrayList<Integer>()),
				new int[] {});

	}

	private void test(Solution s, List<List<Integer>> expected, int[] input) {
		assertEquals(expected, s.subsets(input));
	}
}
